package com.cluster.platform.controller;

import com.cluster.platform.common.api.CommonResult;
import com.cluster.platform.model.CmsCommentsReply;
import com.cluster.platform.service.CmsCommentsReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName: CmsCommentsReplyController
 */
@Controller
@Api(tags = "CmsCommentsReplyController", value = "评论回复功能接口")
@RequestMapping("/commentsReply")
public class CmsCommentsReplyController {

    @Autowired
    private CmsCommentsReplyService cmsCommentsReplyService;

    /**
     * 新增回复
     */
    @ApiOperation("新增回复")
    @RequestMapping(value = "/addCommentsReply", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> addCommentsReply(CmsCommentsReply cmsCommentsReply) {
        return cmsCommentsReplyService.addCommentsReply(cmsCommentsReply);
    }

    /**
     * 查询回复
     */
    @ApiOperation("查询回复")
    @RequestMapping(value = "/searchCommentsReply", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<Object> searchCommentsReply(CmsCommentsReply cmsCommentsReply) {
        return cmsCommentsReplyService.searchCommentsReply(cmsCommentsReply);
    }

    /**
     * 分页查询回复
     */
    @ApiOperation("查询回复")
    @RequestMapping(value = "/searchCommentsReplyPageBy", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<Object> searchCommentsReplyPageBy(CmsCommentsReply cmsCommentsReply,Integer pageNum,Integer pageSize) {
        return cmsCommentsReplyService.searchCommentsReplyPageBy(cmsCommentsReply,pageNum,pageSize);
    }

    /**
     * 删除回复
     */
    @ApiOperation("删除回复")
    @RequestMapping(value = "/deleteCommentsReply", method = RequestMethod.DELETE)
    @ResponseBody
    public CommonResult<Object> deleteCommentsReply(@RequestParam("id") String id) {
        return cmsCommentsReplyService.deleteCommentsReply(id);
    }

    /**
     * 批量删除回复
     */
    @ApiOperation("批量删除回复")
    @RequestMapping(value = "/batchDeleteCommentsReply", method = RequestMethod.DELETE)
    @ResponseBody
    public CommonResult<Object> batchDeleteCommentsReply(List<CmsCommentsReply> cmsCommentsReplies) {
        return cmsCommentsReplyService.batchDeleteCommentsReply(cmsCommentsReplies);
    }

}
